<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
          "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>QUnit for KEYUTIL private key reader 'keyutil.js'</title>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>

<!-- script type="text/javascript" src="qunit.js" /script -->
<!-- link rel="stylesheet" href="qunit.css" type="text/css" media="screen" -->
<script src="qunit.js"></script>
<link rel="stylesheet" href="qunit.css" type="text/css" media="screen"/>

<script language="JavaScript" type="text/javascript" src="../ext/jsbn.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/jsbn2.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/prng4.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/rng.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/base64.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/rsa.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/rsa2.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/sha1.js"></script>
<script language="JavaScript" type="text/javascript" src="../asn1hex-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../rsapem-1.1.js"></script>
<script language="JavaScript" type="text/javascript" src="../rsasign-1.2.js"></script>
<script language="JavaScript" type="text/javascript" src="../base64x-1.1.js"></script>

<script src="../ext/yahoo-min.js"></script>
<script language="JavaScript" type="text/javascript" src="../asn1-1.0.js"></script>

<!-- jsrsasign keyutil external codes -->
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/x64-core.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/cipher-core.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/aes.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/tripledes.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/md5.js"></script>
<!-- for PKCS5 PBKDF2 -->
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/sha1.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/hmac.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/pbkdf2.js"></script>

<script language="JavaScript" type="text/javascript" src="../asn1-1.0.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/ec.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/ec-patch.js"></script>
<script language="JavaScript" type="text/javascript" src="../ecdsa-modified-1.0.js"></script>
<script language="JavaScript" type="text/javascript" src="../ecparam-1.0.js"></script>

<script src="../keyutil-1.0.js"></script>

<script type="text/javascript">
<!--
$(document).ready(function(){


// ======= TEST ===========================================================

// RFC7517 sample1
var pubEC1 = 
{ "kty" : "EC",
  "crv" : "P-256",
  "x" : "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
  "y" : "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0",
  "kid" : "Public key used in JWS spec Appendix A.3 example in RFC7517"
};
// RFC7517 A.1.1 ECC PUB
var pubEC2 = 
{ "kty" : "EC",
  "crv" : "P-256",
  "x" : "MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4",
  "y" : "4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM",
  "use" : "enc",
  "kid" : "1"
};
// RFC7517 A.1.2 RSA PUB
var pubRSA1 = 
{ "kty" : "RSA",
  "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
  "e" : "AQAB",
  "alg" : "RS256",
  "kid" : "2011-04-29"
};
// RFC7517 A.2.1 ECC PRV
var prvEC1 =
{ "kty" : "EC",
  "crv" : "P-256",
  "x" : "MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4",
  "y" : "4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM",
  "d" : "870MB6gfuTJ4HtUnUvYMyJpr5eUZNP4Bk43bVdj3eAE",
  "use" : "enc",
  "kid" : "1"
};
// RFC7517 A.2.2 RSA PRV
var prvRSA1 =
{ "kty" : "RSA",
  "n":"0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
  "e" : "AQAB",
  "d" : "X4cTteJY_gn4FYPsXB8rdXix5vwsg1FLN5E3EaG6RJoVH-HLLKD9M7dx5oo7GURknchnrRweUkC7hT5fJLM0WbFAKNLWY2vv7B6NqXSzUvxT0_YSfqijwp3RTzlBaCxWp4doFk5N2o8Gy_nHNKroADIkJ46pRUohsXywbReAdYaMwFs9tv8d_cPVY3i07a3t8MN6TNwm0dSawm9v47UiCl3Sk5ZiG7xojPLu4sbg1U2jx4IBTNBznbJSzFHK66jT8bgkuqsk0GjskDJk19Z4qwjwbsnn4j2WBii3RL-Us2lGVkY8fkFzme1z0HbIkfz0Y6mqnOYtqc0X4jfcKoAC8Q",
  "p" : "83i-7IvMGXoMXCskv73TKr8637FiO7Z27zv8oj6pbWUQyLPQBQxtPVnwD20R-60eTDmD2ujnMt5PoqMrm8RfmNhVWDtjjMmCMjOpSXicFHj7XOuVIYQyqVWlWEh6dN36GVZYk93N8Bc9vY41xy8B9RzzOGVQzXvNEvn7O0nVbfs",
  "q" : "3dfOR9cuYq-0S-mkFLzgItgMEfFzB2q3hWehMuG0oCuqnb3vobLyumqjVZQO1dIrdwgTnCdpYzBcOfW5r370AFXjiWft_NGEiovonizhKpo9VVS78TzFgxkIdrecRezsZ-1kYd_s1qDbxtkDEgfAITAG9LUnADun4vIcb6yelxk",
  "dp" : "G4sPXkc6Ya9y8oJW9_ILj4xuppu0lzi_H7VTkS8xj5SdX3coE0oimYwxIi2emTAue0UOa5dpgFGyBJ4c8tQ2VF402XRugKDTP8akYhFo5tAA77Qe_NmtuYZc3C3m3I24G2GvR5sSDxUyAN2zq8Lfn9EUms6rY3Ob8YeiKkTiBj0",
  "dq" : "s9lAH9fggBsoFR8Oac2R_E2gw282rT2kGOAhvIllETE1efrA6huUUvMfBcMpn8lqeW6vzznYY5SSQF7pMdC_agI3nG8Ibp1BUb0JUiraRNqUfLhcQb_d9GF4Dh7e74WbRsobRonujTYN1xCaP6TO61jvWrX-L18txXw494Q_cgk",
  "qi" : "GyM_p6JrXySiz1toFgKbWV-JdI3jQ4ypu9rbMWx3rQJBfmt0FoYzgUIZEVFEcOqwemRN81zoDAaa-Bk0KWNGDjJHZDdDmFhW3AN7lI-puxk_mHZGJ11rxyR8O55XLSe3SPmRfKwZI6yU24ZxvQKFYItdldUKGzO6Ia6zTKhAVRU",
  "alg" : "RS256",
  "kid" : "2011-04-29"
};

// _test/z4.prv with P/Q/DP/DQ/COEFF
var prvRSA2 =
{ "kty" : "RSA",
  "n" : "AN906qi0d3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v5a5UCs5YgxkWPtJFfbIZ1Zr-XHCCY09JIWReOGQG226OhjwixKtOK_OqmAKtMKM9OmKviJRHNbDhbTxumN3u7cL8dftjXpSryiEQlPmWyW94MneI2WNIrvh4wruQuDt8EztgOiDFxwcnUgey8iend7WmZnE7E",
  "dq" : "O-bSTUQ4N_UuQezgkF3TDrnBraO67leDGwRbfiE_U0ghQvqh5DA0QSPVzlWDZc9KUitvj8vxsR9o1PW9GS0an17GJEYuetLnkShKK3NWOhBBX6d1yP9rVdH6JhgIJEy_g0Suz7TAFiFc8i7JF8u4QJ05C8bZAMhOLotqftQeVOM",
  "qi" : "InfGmkb2jNkPGuNiZ-mU0-ZrOgLza_fLL9ErZ35jUPhGFzdGxJNobklvsNoTd-E2GAU41YkJh24bncMLvJVYxHHA5iF7FBWx1SvpEyKVhhnIcuXGD7N5PbNZzEdmr9C6I7cPVkWO-sUV7zfFukexIcANmsd_oBBGKRoYzP5Tti4",
  "alg" : "RS256",
  "kid" : "_test/z4.prv"
};
// _test/z4.prv *without* P/Q/DP/DQ/COEFF
var prvRSA2s =
{ "kty" : "RSA",
  "n" : "AN906qi0d3nlJg7R0vPahd6eDD-1n6rdmY495WYy44whg78K_XCTZTQ4rim6Dg4FIk-GXT1mzojAHw3A85TsQNOAw5xBRgH_pA0IjUntmbagu25yHPPikhv6jhkCFWmsuFHK-qLw5MpDuR8Z-zlO7CafUz_R9CR_MzEAOmM4o2B_S7LqU3q62N1Os8ooVRA11zr9PLwR5OdATBSWxPYsBcJ8QrFOflGVGWMPO1LtJ-CzxUvQU_LVCLwH50VyBFgoWtymxVpnWUGZcqxcNG7lBH9GDd_0NGrgZHWw0fxEtj24CkyXZI3P6xHjNE8bzlH-x7lDToa7QFRDdQ-brsRNVks",
  "e" : "AQAB",
  "d" : "DjU54mYvHpICXHjc5-JiFqiH8NkUgOG8LL4kwt3DeBp9bP0-5hSJH8vmzwJkeGG9L79EWG4b_bfxgYdeNX7cFFagmWPRFrlxbd64VRYFawZHRJ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UMvOAytqdxhO2HysiP
n4W58OaJd1tY4372Qpiv6enmUeI4MidCie+s+d0/B6A0xfhU5EeeaDN0xDOOl8yN
+kaaVj9b4HDR3c91OAwKpDJQIeJVZtxoijxl+SRx3u7Vs/7meeSpOfECgYEA7a5K
nUs1pTo72A+JquJvIz4Eu794Yh3ftTk/Et+83aE/FVc6Nk+EhfnwYSNpVmM6UKdr
Aoy5gsCvZPxrq+eR9pEwU8M5UOlki03vWY/nqDBpJSIqwPvGHUB16zvggsPQUyQB
fnN3N8XlDi12n88ltvWwEhn1LQOwMUALEfka9/sCgYAMH2ca4emVj/te/lrlQKzl
iDGRY+0kV9shnVmv5ccIJjT0khZF44ZAbbbo6GPCLEq04r86qYAq0woz06Yq+IlE
c1sOFtPG6Y3e7twvx1+2NelKvKIRCU+ZbJb3gyd4jZY0iu+HjCu5C4O3wTO2A6IM
XHBydSB7LyJ6d3taZmcTsQKBgDvm0k1EODf1LkHs4JBd0w65wa2juu5XgxsEW34h
P1NIIUL6oeQwNEEj1c5Vg2XPSlIrb4/L8bEfaNT1vRktGp9exiRGLnrS55EoSitz
VjoQQV+ndcj/a1XR+iYYCCRMv4NErs+0wBYhXPIuyRfLuECdOQvG2QDITi6Lan7U
HlTjAoGAInfGmkb2jNkPGuNiZ+mU0+ZrOgLza/fLL9ErZ35jUPhGFzdGxJNobklv
sNoTd+E2GAU41YkJh24bncMLvJVYxHHA5iF7FBWx1SvpEyKVhhnIcuXGD7N5PbNZ
zEdmr9C6I7cPVkWO+sUV7zfFukexIcANmsd/oBBGKRoYzP5Tti4=
-----END RSA PRIVATE KEY-----
*/}).toString().match(/\/\*([^]*)\*\//)[1];

test("getKey JWK pubEC1", function() {
  var ec = KEYUTIL.getKey(pubEC1);
  equal(ec.isPublic, true, "is public key");
  equal(ec.curveName, "P-256", "P-256");
  equal(ec.pubKeyHex, "047fcdce2770f6c45d4183cbee6fdb4b7b580733357be9ef13bacf6e3c7bd15445c7f144cd1bbd9b7e872cdfedb9eeb9f4b3695d6ea90b24ad8a4623288588e5ad", "04xy");
});

test("getKey JWK pubEC2", function() {
  var ec = KEYUTIL.getKey(pubEC2);
  equal(ec.isPublic, true, "is public key");
  equal(ec.curveName, "P-256", "P-256");
  equal(ec.pubKeyHex, "0430a0424cd21c2944838a2d75c92b37e76ea20d9f00893a3b4eee8a3c0aafec3ee04b65e92456d9888b52b379bdfbd51ee869ef1f0fc65b6659695b6cce081723", "04xy");
});

test("getKey JWK pubRSA1", function() {
  var k = KEYUTIL.getKey(pubRSA1);
  equal(k.isPublic, true, "is public key");
  equal(k.n.toString(16), "d2fc7b6a0a1e6c67104aeb8f88b257669b4df679ddad099b5c4a6cd9a88015b5a133bf0b856c7871b6df000b554fceb3c2ed512bb68f145c6e8434752fab52a1cfc124408f79b58a4578c16428855789f7a249e384cb2d9fae2d67fd96fb926c198e077399fdc815c0af097dde5aadeff44de70e827f4878432439bfeeb96068d0474fc50d6d90bf3a98dfaf1040c89c02d692ab3b3c2896609d86fd73b774ce0740647ceeeaa310bd12f985a8eb9f59fdd426cea5b2120f4f2a34bcab764b7e6c54d6840238bcc40587a59e66ed1f33894577635c470af75cf92c20d1da43e1bfc419e222a6f0d0bb358c5e38f9cb050aeafe904814f1ac1aa49cca9ea0ca83", "n");
  equal(k.e, 65537, "65537");
});

test("getKey JWK prvEC1", function() {
  var ec = KEYUTIL.getKey(prvEC1);
  equal(ec.isPrivate, true, "is private key");
  equal(ec.curveName, "P-256", "P-256");
  equal(ec.prvKeyHex, "f3bd0c07a81fb932781ed52752f60cc89a6be5e51934fe01938ddb55d8f77801", "d");
});

test("getKey JWK prvRSA1", function() {
  var k = KEYUTIL.getKey(prvRSA1);
  equal(k.isPrivate, true, "is private key");
  equal(k.n.toString(16), "d2fc7b6a0a1e6c67104aeb8f88b257669b4df679ddad099b5c4a6cd9a88015b5a133bf0b856c7871b6df000b554fceb3c2ed512bb68f145c6e8434752fab52a1cfc124408f79b58a4578c16428855789f7a249e384cb2d9fae2d67fd96fb926c198e077399fdc815c0af097dde5aadeff44de70e827f4878432439bfeeb96068d0474fc50d6d90bf3a98dfaf1040c89c02d692ab3b3c2896609d86fd73b774ce0740647ceeeaa310bd12f985a8eb9f59fdd426cea5b2120f4f2a34bcab764b7e6c54d6840238bcc40587a59e66ed1f33894577635c470af75cf92c20d1da43e1bfc419e222a6f0d0bb358c5e38f9cb050aeafe904814f1ac1aa49cca9ea0ca83", "n");
  equal(k.e, 65537, "65537");
  equal(k.d.toString(16), "5f8713b5e258fe09f81583ec5c1f2b7578b1e6fc2c83514b37913711a1ba449a151fe1cb2ca0fd33b771e68a3b1944649dc867ad1c1e5240bb853e5f24b33459b14028d2d6636befec1e8da974b352fc53d3f6127ea8a3c29dd14f3941682c56a78768164e4dda8f06cbf9c734aae8003224278ea9454a21b17cb06d178075868cc05b3db6ff1dfdc3d56378b4edadedf0c37a4cdc26d1d49ac26f6fe3b5220a5dd29396621bbc688cf2eee2c6e0d54da3c782014cd0739db252cc51caeba8d3f1b824baab24d068ec903264d7d678ab08f06ec9e7e23d960628b744bf94b3694656463c7e417399ed73d076c891fcf463a9aa9ce62da9cd17e237dc2a8002f1", "d");
  equal(k.p.toString(16), "f378beec8bcc197a0c5c2b24bfbdd32abf3adfb1623bb676ef3bfca23ea96d6510c8b3d0050c6d3d59f00f6d11fbad1e4c3983dae8e732de4fa2a32b9bc45f98d855583b638cc9823233a949789c1478fb5ceb95218432a955a558487a74ddfa19565893ddcdf0173dbd8e35c72f01f51cf3386550cd7bcd12f9fb3b49d56dfb", "p");
  equal(k.q.toString(16), "ddd7ce47d72e62afb44be9a414bce022d80c11f173076ab78567a132e1b4a02baa9dbdefa1b2f2ba6aa355940ed5d22b7708139c276963305c39f5b9af7ef40055e38967edfcd1848a8be89e2ce12a9a3d5554bbf13cc583190876b79c45ecec67ed6461dfecd6a0dbc6d9031207c0213006f4b527003ba7e2f21c6fac9e9719", "q");
  equal(k.dmp1.toString(16), "1b8b0f5e473a61af72f28256f7f20b8f8c6ea69bb49738bf1fb553912f318f949d5f7728134a22998c31222d9e99302e7b450e6b97698051b2049e1cf2d436545e34d9746e80a0d33fc6a4621168e6d000efb41efcd9adb9865cdc2de6dc8db81b61af479b120f153200ddb3abc2df9fd1149aceab63739bf187a22a44e2063d", "dmp1");
  equal(k.dmq1.toString(16), "b3d9401fd7e0801b28151f0e69cd91fc4da0c36f36ad3da418e021bc896511313579fac0ea1b9452f31f05c3299fc96a796eafcf39d8639492405ee931d0bf6a02379c6f086e9d4151bd09522ada44da947cb85c41bfddf461780e1edeef859b46ca1b4689ee8d360dd7109a3fa4ceeb58ef5ab5fe2f5f2dc57c38f7843f7209", "dmq1");
  equal(k.coeff.toString(16), "1b233fa7a26b5f24a2cf5b6816029b595f89748de3438ca9bbdadb316c77ad02417e6b7416863381421911514470eab07a644df35ce80c069af819342963460e3247643743985856dc037b948fa9bb193f987646275d6bc7247c3b9e572d27b748f9917cac1923ac94db8671bd0285608b5d95d50a1b33ba21aeb34ca8405515", "coeff");
});

test("getKey JWK prvRSA2 compare to PEM", function() {
  var k1 = KEYUTIL.getKey(prvRSA2);
  var k2 = KEYUTIL.getKey(prvRSA2PEM);
  equal(k1.isPrivate, true, "is private key");
  equal(k1.n.compareTo(k2.n), 0, "n");
  equal(k1.e, k2.e, "e");
  equal(k1.d.compareTo(k2.d), 0, "d");
  equal(k1.p.compareTo(k2.p), 0, "p");
  equal(k1.q.compareTo(k2.q), 0, "q");
  equal(k1.dmp1.compareTo(k2.dmp1), 0, "dmp1");
  equal(k1.dmq1.compareTo(k2.dmq1), 0, "dmq2");
  equal(k1.coeff.compareTo(k2.coeff), 0, "coeff");
});

test("getKey JWK prvRSA2s(without P/Q/DP/DQ/COEFF) compare to PEM", function() {
  var k1 = KEYUTIL.getKey(prvRSA2s);
  var k2 = KEYUTIL.getKey(prvRSA2PEM);
  equal(k1.isPrivate, true, "is private key");
  equal(k1.n.compareTo(k2.n), 0, "n");
  equal(k1.e, k2.e, "e");
  equal(k1.d.compareTo(k2.d), 0, "d");
});

});
-->
</script>
  
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">test markup</div>
<a href="index.html">TEST INDEX</a> | 
</body>
</html>


